package com.whfc.openapi.api.emp.controller;

import com.whfc.openapi.api.emp.service.OpenApiEmpHelmetService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;


/**
 * @author sun_guodong
 * @description
 * @date 2020-06-22
 */
@RestController
@RequestMapping("/open/api/v1/helmet")
public class OpenApiEmpHelmetController implements Serializable {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private OpenApiEmpHelmetService openApiEmpHelmetService;

    /**
     * 成都筑邦智能安全帽
     * @param body
     * @return
     */
    @PostMapping(value = "/anon/zbzn/receiveData")
    public String receiveZbznData(@RequestBody String body) {
        logger.info("成都筑邦智能安全帽:{}", body);

        try {
            openApiEmpHelmetService.receiveZbznData(body);
        } catch (Exception e) {
            logger.error("筑邦安全帽数据处理异常",e);
        }
        return "ok";
    }
}
